package com.tangsm.spring.boot.xml.config;

import com.tangsm.spring.boot.xml.filter.ParameterNameConverterFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * 过滤器注册
 *
 * @author tangsm
 */
@Configuration
public class FilterConfig {

    /**
     * GET请求参数下划线专驼峰过滤器注册
     *
     * @return FilterRegistrationBean<ParameterNameConverterFilter>
     */
    @Bean
    public FilterRegistrationBean<ParameterNameConverterFilter> getParameterNameConverterFilterRegistrationBean() {
        FilterRegistrationBean<ParameterNameConverterFilter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new ParameterNameConverterFilter());
        registrationBean.addUrlPatterns("/xxxx/*");
        registrationBean.setName("parameterNameConverterFilter");
        registrationBean.setOrder(0);
        return registrationBean;
    }
}
